import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class CupertinoPickerDemo extends StatefulWidget {
  @override
  _CupertinoPickerDemoState createState() => _CupertinoPickerDemoState();
}

class _CupertinoPickerDemoState extends State<CupertinoPickerDemo> {
  int _selectedItem = 0;
  final List<String> _items = List<String>.generate(10, (index) => 'Item $index');

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Cupertino Picker Demo'),
      ),
      body: Center(
        child: CupertinoPicker(
          looping: true,
          backgroundColor: Colors.black,
          itemExtent: 32.0,
          onSelectedItemChanged: (int index) {
            setState(() {
              _selectedItem = index;
            });
          },
          children: _items.map((String item) {
            return Center(
              child: Text(item,style: TextStyle(
                color: Colors.white
              ),),
            );
          }).toList(),
        ),
      ),
    );
  }
}